<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付信息</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <style>
        body,ul ,li,p,h1{
            margin: 0 ;
            padding: 0;
        }
        html{
            font-family: '微软雅黑';
        }
        body{
            background: rgb(245,245,245);
        }
        li{
            list-style: none;
        }
        .main {
            width: 100%;
        }
        .main h1{
            margin-top: 5%;
            text-align: center;
        }
        .main ul{
            margin-top: 5%;
            width: 100%;
            background: #ffffff;
        }
        .main ul li{
            box-sizing: border-box;
            width: 100%;
            overflow: hidden;
            padding: 10px;
            border-bottom: 1px solid #cccccc
        }
        .main ul li .p1{
            float: left;
        }
        .main ul li .p2{
            float: right;
        }
        .btn{
            width: 95%;
            margin: 5% auto;
            background: rgb(26,173,25);
            color: #ffffff;
            padding: 3%;
           box-sizing: border-box;
            text-align: center;
            border-radius: 6px;
            font-weight: 500;
        }
    </style>
</head>
<body>
      <div class="main">
          <h1>￥ <span>{{$payOrder->total_fee / 100}}</span></h1>
          <ul>
              <li style="border-top: 1px solid #cccccc">
                  <p class="p1">商品</p>
                  <p class="p2">房卡*{{$num}}</p>
              </li>
              <li>
                  <p class="p1">收款方</p>
                  <p class="p2">来舍麻将</p>
              </li>
          </ul>
          <div class="btn">
              <span onclick="onBridgeReady()">立即支付</span>
          </div>
      </div>
</body>
<script>


    function onBridgeReady() {
        if( typeof WeixinJSBridge === 'undefined' ) {
            alert('请在微信页打开页面！');
            return false;
        }
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest', <?php echo $payment->getConfig(); ?>, function(res) {
                    switch(res.err_msg) {
                        case 'get_brand_wcpay_request:cancel':
                            alert('用户取消支付！');
                            history.go(-1);
                            break;
                        case 'get_brand_wcpay_request:fail':
                            alert('支付失败！（'+res.err_desc+'）');
                            break;
                        case 'get_brand_wcpay_request:ok':
                            window.location.href = '{{$url}}#/NewRoom?mid={{$mid}}&token={{$token}}';
                            break;
                        default:
                            alert(JSON.stringify(res));
                            break;
                    }
                });
    }
    if (typeof WeixinJSBridge == "undefined"){
        if( document.addEventListener ){
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        }else if (document.attachEvent){
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    }else{
        onBridgeReady();
    }

</script>
</html>